import request from "@/utils/request";
import type { IResponseBody } from "./userApi";

export interface IClass {
  id: number;
  nickname: string;
}

export function getInterfilesAll(
  stuId: number
): Promise<IResponseBody<IClass[]>> {
  return request.get(`/interfiles?stuId=${stuId}`);
}

export function addInterfiles(
  studId: number,
  nickname: string
): Promise<IResponseBody<IClass[]>> {
  return request.post("/interfiles", {
    studId,
    nickname,
  });
}

export function modityInterfiles(
  classId: number,
  studId: number,
  id: number,
  interfilesId: string
): Promise<IResponseBody<IClass[]>> {
  return request.put("/interfiles", {
    classId,
    studId,
    id,
    interfilesId,
  });
}
